<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>FileHelpers Library - Marcos Meli</TITLE>
<LINK href="/favicon.ico" rel="SHORTCUT ICON"><LINK 
href="global.css" type=text/css 
rel=stylesheet>

<meta NAME="Description"        content="An easy to use .NET library to read/write data from fixed length or delimited files or streams. It has support to import/export data from different data sources." />
<meta name="Author"             content="Marcos Meli" />
<meta NAME="keywords" Content="filehelpers,CSV,Marcos_Meli,C#,free,opensource,Devoo.net,Delimited Files,Import/Export">
<meta NAME="Copyright" CONTENT="Copyright 2005-07 to Marcos Meli - www.Devoo.net. All Rights Reserved.">

</HEAD>
<BODY   text=black vLink=purple aLink=red link=blue 
bgColor=white leftMargin=0 topMargin=0>

		{$HEADER$}

		<table width="100%" cellpadding="5" cellspacing="5">
<tr><td>
        <p>
            <strong>Note:</strong> VB.NET developers browse the <a href="vb_tips.html">Tips for
                VB.NET</a> first.</p>
        <h2>Attributes List </h2>
    <p>
        <strong><span style="font-size: 14px">Attributes for the record mapping class</span></strong></p>
        <div>
        <ul>
          <li><a href="FileHelpers.FixedLengthRecordAttribute.html">FixedLengthRecord</a>: Indicates a fixed length record file.
            <blockquote>
              <pre>[FixedLengthRecord] 
<span class="cpp-keyword">public class</span> OrdersFixed
{ ...</pre>
            </blockquote>
          </li>
          <li><a href="FileHelpers.DelimitedRecordAttribute.html">DelimitedRecord</a>: Indicates a delimited record file. 
            <blockquote>
              <pre>[DelimitedRecord(<span class="cs-string">"|"</span>)] 
<span class="cs-keyword">public class</span> OrdersVerticalBar 
{ ...

</pre>
            </blockquote>
          </li>
        </ul>

</div><ul>
    <li><a href="FileHelpers.IgnoreFirstAttribute.html">IgnoreFirst</a>: Indicates the <strong>
        numbers of lines to be ignored at the begining</strong> of a file or
              stream when the engine read it.<blockquote>
              <pre>[IgnoreFirst(<span class="cs-string">2</span>)] 
<span class="cs-keyword">public class</span> OrdersVerticalBar 
{ ...

</pre>
            </blockquote>
    </li>

          <li><a href="FileHelpers.IgnoreFirstAttribute.html">IgnoreLast</a>: Indicates the <strong>
        numbers of lines to be ignored at the end</strong> of a file or stream
              when the engine read it.<blockquote>
              <pre>[IgnoreLast(<span class="cs-string">2</span>)] 
<span class="cs-keyword">public class</span> OrdersVerticalBar 
{ ...

</pre>
            </blockquote>
          </li>
          <li><a href="FileHelpers.IgnoreEmptyLinesAttribute.html">IgnoreEmptyLines</a>: Indicates that the empty lines (only contains a NewLine)  must be ignored by the engine.<blockquote>
              <pre>[IgnoreEmptyLines()] 
<span class="cs-keyword">public class</span> NotEmptyPlease
{ ...

</pre>
            </blockquote>
          </li><li><a href="FileHelpers.ConditionalRecordAttribute.html">ConditionalRecord</a>: <img src="new.gif" border="0" /> &nbsp;&nbsp;Allow you to add some conditions to tell the library what records to
              process or not in a declarative way. using one of the <a href="FileHelpers.RecordCondition.html">
                  RecordCondition</a> Enum and a string selector. Useful to ignore commented or
              similar files.<blockquote>
                  <pre>
[DelimitedRecord(",")] 
[ConditionalRecord(<span style="color: #006699">RecordCondition.ExcludeIfBegins</span>, "//")] 
<span style="color: #000099">public class </span>ConditionalType1 
{ 
<span style="color: #006600">// Regular Expressions </span>[DelimitedRecord(",")]
[ConditionalRecord(<span style="color: #336699">RecordCondition.IncludeIfMatchRegex</span>, ".*abc??")]
<span style="color: #000099">public class</span> ConditionalType3
{ 

</pre>
              </blockquote>
          </li>

        </ul>
        <p>
            <span style="font-size: 14px"><strong>Attributes for the fields inside the class</strong><br/>
            </span>
        </p>
    <p>
        All the attributes for the Fields begin with [Field.. then you can easy found all of them.
    </p>
        <ul>
          <li><a href="FileHelpers.FieldFixedLengthAttribute.html">FieldFlixedLength</a>: Indicates the length of the record (only valid when the class have a <a href="FileHelpers.FixedLengthRecordAttribute.html">FixedLengthRecord</a>)
            <blockquote>
              <pre>[FieldFixedLength(<span class="cs-literal">12</span>)]
<span class="cs-keyword">public string</span> CustomerID;</pre>
            </blockquote>
          </li>
          <li><a href="FileHelpers.FieldDelimiterAttribute.html">FieldDelimiter</a>: Indicates a diferent delimiter for this field (only valid when the class have a <a href="FileHelpers.DelimitedRecordAttribute.html">DelimitedRecord</a>)          
          <blockquote>
            <pre>[FieldDelimiter(<span class="cs-string">","</span>)]
<span class="cs-keyword">public string</span> CustomerName;
            </pre>
          </blockquote>
          </li>
          <li><a href="FileHelpers.FieldConverterAttribute.html">FieldConverter</a>: Indicates converter used to to provide string to field type convertion and viceversa. And can add a list of parameters that pass directly to the constructor of the converter, in the example is a string that represents a format of the Date field. 
            <blockquote>
              <pre>[FieldConverter(<a href="FileHelpers.ConverterKind.html">ConverterKind</a>.Date, <span class="cs-string">"ddMMyyyy"</span> )]
<span class="cs-keyword">public DateTime</span> ShippedDate;

[FieldConverter(typeof(YourCustomConverter)))]
<span class="cs-keyword">public YourType</span> CustomTypeField;
</pre>
<b>Remember:</b> The fault types are auto converted, so don't need the explicit [FieldConverter] use it only when you 
need to pass them some argument. Check out the <a href="converter_args.html">Default Converters Arguments Page</a>.<br />
You can see also the <a href="example_customconv.html">Custom Converter Example</a>

            </blockquote>
          </li>
          <li><a href="FileHelpers.FieldQuotedAttribute.html">FieldQuoted</a>: Indicates that the field must be read and written like a Quoted String. (you can pass the quote char and can set if the quote is optional like the Excel CSV format)
          <blockquote>
            <pre>[FieldQuoted()] // Quoted with "
<span class="cs-keyword">public string </span>CustomerName

[FieldQuoted('[')] // Quoted between [brakets]
<span class="cs-keyword">public string </span>CustomerName

[FieldQuoted('"', <a href="FileHelpers.QuoteMode.html">QuoteMode</a>.OptionalForBoth)] // Optional quoted when read or write
<span class="cs-keyword">public string </span>CustomerName

[FieldQuoted('"', <a href="FileHelpers.MultilineMode.html">MultilineMode</a>.AllowForBoth)] // Indicates that the quoted string can span multiple lines
<span class="cs-keyword">public string </span>CustomerName
</pre>

          </blockquote>
          
          </li>
          <li><a href="FileHelpers.FieldNullValueAttribute.html">FieldNullValue</a>: Indicates a default value is the field position is empty.
            <blockquote>
              <pre>[FieldNullValue(<span class="cs-keyword">typeof</span>(<span class="cs-keyword">DateTime</span>), <span class="cs-string">"2005-1-1"</span> )]
<span class="cs-keyword">public DateTime</span> ShippedDate

</pre>
            </blockquote>
          </li>
          <li><a href="FileHelpers.FieldTrimAttribute.html">FieldTrim</a>: Indicates what type of trim must be perfomed later of <strong>read</strong> a field value (see <a href="FileHelpers.TrimMode.html">TrimMode</a>).
            <blockquote>
              <pre>[FieldTrim(<a href="FileHelpers.TrimMode.html">TrimMode</a>.Both)]<span class="cs-keyword">
public string</span> CustomerName</pre>
            </blockquote>
          </li>
          <li><a href="FileHelpers.FieldAlignAttribute.html">FieldAlign</a>: Indicates what type of aligment and align char that must be used before <strong>write</strong> a field value (see <a href="FileHelpers.AlignMode.html">AlignMode</a>).
            <blockquote>
              <pre>[FieldAlign(<a href="FileHelpers.AlignMode.html">AlignMode</a>.Right, <span class="cs-string">'0'</span>)]<span class="cs-keyword">
public int </span>Going_to_the_Right</pre>
            </blockquote>
          </li>
        <li><a href="FileHelpers.FieldIgnoredAttribute.html">FieldIgnored</a>: Indicates that
            the target field is ignored by the engine. (the engine completely ignore it !!). Is useful when you need to add a field to your record class but it is not relevant for the mapping. 
    <blockquote>
        <pre>[FieldIgnored()]
<span class="cs-keyword">public int </span>Why_Ignore_Me</pre>
    </blockquote>
</li>

        <li><a href="FileHelpers.FieldInNewLineAttribute.html">FieldInNewLine</a>: Indicates that
            before the field value is a New Line.<br /><b>If you use this attribute the library request that new line that not is optional.</b>
    <blockquote>
        <pre>[FieldInNewLine()]
<span class="cs-keyword">public string </span>I_Wanna_Stay_Alone</pre>
    </blockquote>
</li>

        <li><a href="FileHelpers.FieldOptionalAttribute.html">FieldOptional</a>: Indicates that
            the target field can stay or not in the file.<br /><b>When you apply this attribute to a field, you must apply it to the following ones.</b>
    <blockquote>
        <pre>[FieldOptional()]
<span class="cs-keyword">public string </span>Maybe_I_be_there</pre>
    </blockquote>
</li>

    </ul>    
            
					{$FOOTER$}

</BODY></HTML>
